<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        [href$=".jpg"] {
            background-color: pink;
        }
    </style>
</head>

<body>
    <a href="photo.jpg">照片</a>
    <a href="doc.pdf">文档</a>
</body>

</html>